SQL Genie Tables Tab

Description

The Tables tab of the SQL Genie defines the tables that will provide the data for your report.

images/SQR_SQL_Genie_Tables_tab.gif

Any time that the Execute Query button ('lightning' icon)is enabled, you may click it to see a sample of the records that the query will return. At any time you may click the History button to see a list of SQL statements previously created in this session in the SQL History Dialog.

Selecting the First Table

  1. Click Add Table to display the Add Table dialog.

  2. Optionally, to include more items in the list, select any of the check boxes at the bottom of the dialog.

  3. Select a table from the list and click OK.

Selecting Additional Tables

The default assumption is that an additional table will connect to a previously selected table with a common linking field.

  1. Click Add Table to display the Add Table dialog.

  2. Optionally, to include more items in the list, select any of the check boxes at the bottom of the dialog.

  3. Select a table from the list and click Next >.

  4. Select the field(s) that link the two tables from the Linking Fields lists. For example, the following picture shows the relationship between the Customers and the Orders tables of the Northwinds database.

    images/SQR_Define_Linking_Fields.gif
  5. By default an additional table is assumed to be linked to its parent by an INNER JOIN. If you want to change this:

    • 1. Optionally, select the Table is not joined check box.

    • 2. Optionally, click Define Join Type to display the Join Type dialog.

    • 3. Make a selection and click OK. The options are:

      • Inner Join

        Default selection. An INNER JOIN only includes records where the joined fields from both tables are equal.

      • Left Outer Join

        A LEFT OUTER JOIN includes all records from the parent table and only those records from the child table where the joined fields are equal.

      • Right Outer Join

        A RIGHT OUTER JOIN includes all records from the child table and only those records from the parent table where the joined fields are equal.

      • Full Outer Join

        A FULL OUTER JOIN includes all records from parent and child tables.

  6. Click Finish to return to the SQL Genie.

Deleting a Table

To delete a table:

  1. Select the table in the Selected Tables list.

  2. Click Delete Table.

Modifying JOIN Definitions

After you have defined a JOIN relationship between 2 tables, you may modify the relationship of the child table to its parent table.

  1. Select the child table in the Selected Tables list.

  2. Optionally, select a different parent table from the Parent table list.

  3. Optionally, click Join type to display the Join Type dialog and select a different method of linking the tables.

  4. Optionally, click Join Conditions to display the Edit Join Expression dialog:

    • In this dialog you may select different linking fields.

    • Optionally, click Define complex join expression to directly edit the SQL linking expression.

  5. Click OK to continue.

Editing a SQL Join Expression

When using the Edit Join Expression dialog, you may use the genie to retrieve and insert field names, functions, or operators.

See Also